package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    int countByDishIds(List<Long> ids);

    void insertBatch(List<SetmealDish> setmealDishes);

    void deleteBySetmealIds(List<Long> ids);

    @Select("select count(*) from setmeal_dish sd ,dish d where sd.dish_id=d.id and d.status=0 and sd.setmeal_id=#{id}")
    int countDiableDishesBySetmealId(Long id);

    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> selectBySetmealId(Long id);



    @Select("select sd.name name ,sd.copies copies,d.image image , d.description description from setmeal_dish sd ,dish d \n" +
            "where sd.dish_id=d.id and sd.setmeal_id= #{id}")
    List<DishItemVO> selectDishVOBySetmealId(Long id);
}
